# $Id$
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Jonathan Liu <net147@gmail.com>

pkgname=ossp
pkgver=1.3.2
pkgrel=15
pkgdesc="Emulate OSS device using CUSE"
arch=(i686 x86_64)
url="http://sourceforge.net/projects/osspd"
license=(GPL2)
depends=('fuse>=2.8.0')
makedepends=(libpulse alsa-lib git)
optdepends=("libpulse: PulseAudio backend"
            "alsa-lib: ALSA backend")
source=('ossp::git://git.code.sf.net/p/osspd/code#commit=097dc7b'
        osspd.service osspd.modules-load)
md5sums=('SKIP'
         'd084bd24e3dff167541dd3ff860cdebf'
         '36c01e144db7cf253df12d8ad9dac942')

prepare() {
  cd $pkgname
  sed -i 's|/sbin|/bin|g' Makefile
  sed -i 's|GROUP="audio"|SUBSYSTEM=="cuse", MODE="0666"|' 98-osscuse.rules
}

build() {
  cd $pkgname
  make
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" prefix=/usr UDEVDIR=/usr/lib/udev/rules.d install

  install -Dm644 "$srcdir/osspd.service" "$pkgdir/usr/lib/systemd/system/osspd.service"
  install -Dm644 "$srcdir/osspd.modules-load" "$pkgdir/usr/lib/modules-load.d/osspd.conf"

  install -Dm644 README "$pkgdir/usr/share/doc/$pkgname/README"
}
